package com.blrs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.blrs.common.core.page.PageDomain;
import com.blrs.common.core.page.TableSupport;
import com.blrs.common.utils.page.PaginationUtil;
import com.blrs.service.honor.IHonorResumeService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.blrs.common.annotation.Log;
import com.blrs.common.core.controller.BaseController;
import com.blrs.common.core.domain.AjaxResult;
import com.blrs.common.enums.BusinessType;
import com.blrs.domain.HonorResume;
import com.blrs.common.utils.poi.ExcelUtil;
import com.blrs.common.core.page.TableDataInfo;

/**
 * 荣誉资质履历Controller
 * 
 * @author zhongliang
 * @date 2023-08-28
 */
@RestController
@RequestMapping("/resume/resume")
public class HonorResumeController extends BaseController
{
    @Autowired
    private IHonorResumeService honorResumeService;

    /**
     * 查询荣誉资质履历列表
     */
    //@PreAuthorize("@ss.hasPermi('resume:resume:list')")
    @GetMapping("/list")
    public TableDataInfo list(HonorResume honorResume)
    {
        startPage();
        List<HonorResume> list = honorResumeService.selectHonorResumeList(honorResume);
        return getDataTable(list);
    }

    /**
     * 导出荣誉资质履历列表
     */
    //@PreAuthorize("@ss.hasPermi('resume:resume:export')")
    @Log(title = "荣誉资质履历", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HonorResume honorResume)
    {
        List<HonorResume> list = honorResumeService.selectHonorResumeList(honorResume);
        ExcelUtil<HonorResume> util = new ExcelUtil<HonorResume>(HonorResume.class);
        util.exportExcel(response, list, "荣誉资质履历数据");
    }

    /**
     * 获取荣誉资质履历详细信息
     */
    //@PreAuthorize("@ss.hasPermi('resume:resume:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(honorResumeService.selectHonorResumeById(id));
    }

    /**
     * 新增荣誉资质履历
     */
    //@PreAuthorize("@ss.hasPermi('resume:resume:add')")
    @Log(title = "荣誉资质履历", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HonorResume honorResume)
    {
        return toAjax(honorResumeService.insertHonorResume(honorResume));
    }

    /**
     * 修改荣誉资质履历
     */
    //@PreAuthorize("@ss.hasPermi('resume:resume:edit')")
    @Log(title = "荣誉资质履历", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HonorResume honorResume)
    {
        return toAjax(honorResumeService.updateHonorResume(honorResume));
    }

    /**
     * 删除荣誉资质履历
     */
    //@PreAuthorize("@ss.hasPermi('resume:resume:remove')")
    @Log(title = "荣誉资质履历", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(honorResumeService.deleteHonorResumeByIds(ids));
    }
}
